package cool.mor.controller;

import cool.mor.dto.EmployeeDto;
import cool.mor.dto.PersonnelManagementPageQueryDto;
import cool.mor.entity.Employee;
import cool.mor.form.EmployeeForm;
import cool.mor.form.PersonnelManagementPageQueryForm;
import cool.mor.service.EmployeeService;
import cool.mor.service.PersonnelManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Ivan
 */
@RestController
public class PersonalDataController {
    @Autowired
    EmployeeService employeeService;
    /**
     * 根据登录用户的id来查询当前用户的个人信息
     * @param id
     * @return
     */
    @GetMapping("/getPersonalDataById")
    public EmployeeDto getPersonalDataById(String id){
        return employeeService.queryById(id);
    }

    /**
     * 根据登录用户修改的数据来更新后台的个人数据
     * @param employeeForm
     * @return
     */
    @PutMapping("/changePersonalData")
    public EmployeeDto changePersonalData(EmployeeForm employeeForm){
        return employeeService.update(employeeForm);
    }

}
